import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);


const index = resolve => {
  require.ensure(['../vue/index.vue'], () => {
    resolve(require('../vue/index.vue'));
  });
};

const detail = resolve => {
  require.ensure(['../vue/detail.vue'], () => {
    resolve(require('../vue/detail.vue'));
  });
};

const order = resolve => {
  require.ensure(['../vue/order.vue'], () => {
    resolve(require('../vue/order.vue'));
  });
};

const order_list = resolve => {
  require.ensure(['../vue/order_list.vue'], () => {
    resolve(require('../vue/order_list.vue'));
  });
};

const pay = resolve => {
  require.ensure(['../vue/pay.vue'], () => {
    resolve(require('../vue/pay.vue'));
  });
};

const adress = resolve => {
  require.ensure(['../vue/adress.vue'], () => {
    resolve(require('../vue/adress.vue'));
  });
};
const new_adress = resolve => {
  require.ensure(['../vue/new_adress.vue'], () => {
    resolve(require('../vue/new_adress.vue'));
  });
};

const routes = [{
  path: '/index',
  name: 'index',
  component: index
}, {
  path: '/',
  name: 'index',
  component: index
}, {
  path: '/goods',
  name: 'detail',
  component: detail
}, {
  path: '/order',
  name: 'order',
  component: order
},{
  path: '/order_list',
  name: 'order_list',
  component: order_list
},{
  path: '/adress',
  name: 'adress',
  component: adress
}, {
  path: '/new_adress',
  name: 'new_adress',
  component: new_adress
},{
  path: '/pay',
  name: 'pay',
  component: pay
}];

export default new Router({
  mode: 'hash',
  /*mode: 'history',*/
  routes
});
